package com.glodon.paas.databag.dao;

import java.util.List;

import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;
import org.springframework.stereotype.Repository;

import com.glodon.paas.databag.model.DatabagTask;

@Repository
public interface DatabagTaskRepository extends CrudRepository<DatabagTask, String>, DatabagTaskRepositoryCustom {
    
    public List<DatabagTask> findByTaskId(String taskId);
    
    public List<DatabagTask> findByDatabagId(String databagId);

    @Modifying
    @Query("delete from DatabagTask t where t.databagId=?1")
    public void deleteDatabagTasks(String databagId);
}
